<template>
  <div class="nav-menu-wrapper">
    <el-menu
      class="nav-menu"
      @open="handleOpen"
      @close="handleClose"
      @select="handleSelect"
      background-color="#515A6E"
      text-color="#fff"
      active-text-color="#4A7EE4"
      :default-active="defaultActive"
      :unique-opened="true"
      router
      :style="{height:navHeigth}"
    >

      <el-menu-item index="personal"
      ><i class="el-icon-s-order"></i>
        <span>个人信息</span>
      </el-menu-item>
      <el-menu-item index="clocked"
      ><i class="el-icon-s-order"></i>
        <span>登记记录</span>
      </el-menu-item>
    </el-menu>
  </div>
</template>

<script>
export default {
  props:{
    navHeigth:{
      type:Number,
    }
  },
  name: "NavMenu",
  data() {
    return {
      defaultActive: '',
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    handleSelect(index) {
      console.log(index);
      this.defaultActive = index;
      this.$router.push({
        name: index,
      });
    },
  },

};
</script>

<style>
.nav-menu-wrapper {
  width: 15%;
  height: 100%;
  min-width: 215px;
}

.nav-menu {
  height: 100%;
}
</style>
